<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>15-操作样式</title>
		<style type="text/css">
			#box{
				width:200px;
				height:200px;
				background:red;
			}
		</style>
	</head>
	<body>
		<div id="box"></div>
		<button>点击切换</button>
		<script type="text/javascript">
			//元素对象.style.样式属性 = 值
			var btn = document.querySelector('button');
			var box = document.getElementById('box');
			btn.onclick = function(){
				// box.style.width = 300+'px';
				// //box.style.width = '300px';
				// box.style.height = 300+'px';
				// box.style.background = '#f60';
				// m.style.cssText='color:green;background:cyan;'
				//cssText可以设置多个css样式
				var w=300,h=300;
				box.style.cssText = 'width:'+w+'px'+';'+'height:'+h+'px;';
			}
			
			
		</script>
	</body>
</html>
